Name: 'BackgroundMenu',
Extends: PopupMenu.PopupMenu,
- _init: function(source) {
+ _init: function(source, layoutManager) {
this.parent(source, 0, St.Side.TOP);
this.addSettingsAction(_("Settings"), 'gnome-control-center.desktop');
this.actor.add_style_class_name('background-menu');
- Main.uiGroup.add_actor(this.actor);
+ layoutManager.uiGroup.add_actor(this.actor);
this.actor.hide();
}
});
-function addBackgroundMenu(actor) {
+function addBackgroundMenu(actor, layoutManager) {
let cursor = new St.Bin({ opacity: 0 });
- Main.uiGroup.add_actor(cursor);
+ layoutManager.uiGroup.add_actor(cursor);
actor.reactive = true;
- actor._backgroundMenu = new BackgroundMenu(cursor);
+ actor._backgroundMenu = new BackgroundMenu(cursor, layoutManager);
actor._backgroundManager = new PopupMenu.PopupMenuManager({ actor: actor });
actor._backgroundManager.addMenu(actor._backgroundMenu);
this.emit('hot-corners-changed');
},
- _createBackground: function(monitorIndex) {
+ _addBackgroundMenu: function(bgManager) {
+ BackgroundMenu.addBackgroundMenu(bgManager.background.actor, this);
+ },
+
+ _createBackgroundManager: function(monitorIndex) {
let bgManager = new Background.BackgroundManager({ container: this._backgroundGroup,
layoutManager: this,
monitorIndex: monitorIndex });
- BackgroundMenu.addBackgroundMenu(bgManager.background.actor);
-
- bgManager.connect('changed', Lang.bind(this, function() {
- BackgroundMenu.addBackgroundMenu(bgManager.background.actor);
- }));
- this._bgManagers[monitorIndex] = bgManager;
+ bgManager.connect('changed', Lang.bind(this, this._addBackgroundMenu));
+ this._addBackgroundMenu(bgManager);
- return bgManager.background;
+ return bgManager;
},
- _createSecondaryBackgrounds: function() {
+ _showSecondaryBackgrounds: function() {
for (let i = 0; i < this.monitors.length; i++) {
if (i != this.primaryIndex) {
- let background = this._createBackground(i);
-
+ let background = this._bgManagers[i].background;
+ background.actor.show();
background.actor.opacity = 0;
Tweener.addTween(background.actor,
{ opacity: 255,
}
},
- _createPrimaryBackground: function() {
- this._createBackground(this.primaryIndex);
- },
-
_updateBackgrounds: function() {
let i;
for (i = 0; i < this._bgManagers.length; i++)
if (Main.sessionMode.isGreeter)
return;
- if (this._startingUp)
- return;
-
for (let i = 0; i < this.monitors.length; i++) {
- this._createBackground(i);
+ let bgManager = this._createBackgroundManager(i);
+ this._bgManagers.push(bgManager);
+
+ if (i != this.primaryIndex && this._startingUp)
+ bgManager.background.actor.hide();
}
},
if (Main.sessionMode.isGreeter) {
this.panelBox.translation_y = -this.panelBox.height;
} else {
- this._createPrimaryBackground();
+ this._updateBackgrounds();
// We need to force an update of the regions now before we scale
// the UI group to get the coorect allocation for the struts.
this.keyboardBox.show();
if (!Main.sessionMode.isGreeter) {
- this._createSecondaryBackgrounds();
+ this._showSecondaryBackgrounds();
global.window_group.remove_clip();
}